<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE TupleSections #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Cmm.Pipeline</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-6"></span><span>  </span><span class="hs-comment">-- | Converts C-- with an implicit stack and native C-- calls into</span><span>
</span><span id="line-7"></span><span>  </span><span class="hs-comment">-- optimized, CPS converted and native-call-less C--.  The latter</span><span>
</span><span id="line-8"></span><span>  </span><span class="hs-comment">-- C-- can be used to generate assembly.</span><span>
</span><span id="line-9"></span><span>  </span><span class="annot"><a href="GHC.Cmm.Pipeline.html#cmmPipeline"><span class="hs-identifier">cmmPipeline</span></a></span><span>
</span><span id="line-10"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Lint.html"><span class="hs-identifier">GHC.Cmm.Lint</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Info.Build.html"><span class="hs-identifier">GHC.Cmm.Info.Build</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.CommonBlockElim.html"><span class="hs-identifier">GHC.Cmm.CommonBlockElim</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Switch.Implement.html"><span class="hs-identifier">GHC.Cmm.Switch.Implement</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.ProcPoint.html"><span class="hs-identifier">GHC.Cmm.ProcPoint</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.ContFlowOpt.html"><span class="hs-identifier">GHC.Cmm.ContFlowOpt</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.LayoutStack.html"><span class="hs-identifier">GHC.Cmm.LayoutStack</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Sink.html"><span class="hs-identifier">GHC.Cmm.Sink</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Dataflow.Collections.html"><span class="hs-identifier">GHC.Cmm.Dataflow.Collections</span></a></span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#"><span class="hs-identifier">Data.Either</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#partitionEithers"><span class="hs-identifier">partitionEithers</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- | Top level driver for C-- pipeline</span><span>
</span><span id="line-36"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="annot"><a href="GHC.Cmm.Pipeline.html#cmmPipeline"><span class="hs-identifier hs-type">cmmPipeline</span></a></span><span>
</span><span id="line-39"></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-comment">-- Compilation env including</span><span>
</span><span id="line-40"></span><span>           </span><span class="hs-comment">-- dynamic flags: -dcmm-lint -ddump-cmm-cps</span><span>
</span><span id="line-41"></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.Info.Build.html#ModuleSRTInfo"><span class="hs-identifier hs-type">ModuleSRTInfo</span></a></span><span>        </span><span class="hs-comment">-- Info about SRTs generated so far</span><span>
</span><span id="line-42"></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmGroup"><span class="hs-identifier hs-type">CmmGroup</span></a></span><span>             </span><span class="hs-comment">-- Input C-- with Procedures</span><span>
</span><span id="line-43"></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Info.Build.html#ModuleSRTInfo"><span class="hs-identifier hs-type">ModuleSRTInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmGroupSRTs"><span class="hs-identifier hs-type">CmmGroupSRTs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Output CPS transformed C--</span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span id="cmmPipeline"><span class="annot"><span class="annottext">cmmPipeline :: HscEnv
-&gt; ModuleSRTInfo -&gt; CmmGroup -&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
</span><a href="GHC.Cmm.Pipeline.html#cmmPipeline"><span class="hs-identifier hs-var hs-var">cmmPipeline</span></a></span></span><span> </span><span id="local-6989586621681067640"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067640"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681067639"><span class="annot"><span class="annottext">ModuleSRTInfo
</span><a href="#local-6989586621681067639"><span class="hs-identifier hs-var">srtInfo</span></a></span></span><span> </span><span id="local-6989586621681067638"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067638"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; SDoc
-&gt; ((ModuleSRTInfo, [CmmDeclSRTs]) -&gt; ())
-&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
-&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
forall (m :: * -&gt; *) a.
MonadIO m =&gt;
DynFlags -&gt; SDoc -&gt; (a -&gt; ()) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Error.html#withTimingSilent"><span class="hs-identifier hs-var">withTimingSilent</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067636"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Cmm pipeline&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ModuleSRTInfo, [CmmDeclSRTs]) -&gt; ()
forall {t :: * -&gt; *} {a} {a}. Foldable t =&gt; (a, t a) -&gt; ()
</span><a href="#local-6989586621681067634"><span class="hs-identifier hs-var">forceRes</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (ModuleSRTInfo, [CmmDeclSRTs])
 -&gt; IO (ModuleSRTInfo, [CmmDeclSRTs]))
-&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
-&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681067633"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681067633"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067640"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>     </span><span id="local-6989586621681067631"><span class="annot"><span class="annottext">[Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)]
</span><a href="#local-6989586621681067631"><span class="hs-identifier hs-var">tops</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;tops&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">(CmmDecl -&gt; IO (Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)))
-&gt; CmmGroup
-&gt; IO [Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv
-&gt; CmmDecl
-&gt; IO (Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl))
</span><a href="GHC.Cmm.Pipeline.html#cpsTop"><span class="hs-identifier hs-var">cpsTop</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067640"><span class="hs-identifier hs-var">hsc_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067638"><span class="hs-identifier hs-var">prog</span></a></span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>     </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681067628"><span class="annot"><span class="annottext">[(CAFEnv, CmmGroup)]
</span><a href="#local-6989586621681067628"><span class="hs-identifier hs-var">procs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681067627"><span class="annot"><span class="annottext">[(Set CAFLabel, CmmDecl)]
</span><a href="#local-6989586621681067627"><span class="hs-identifier hs-var">data_</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)]
-&gt; ([(CAFEnv, CmmGroup)], [(Set CAFLabel, CmmDecl)])
forall a b. [Either a b] -&gt; ([a], [b])
</span><a href="../../base/src/Data.Either.html#partitionEithers"><span class="hs-identifier hs-var">partitionEithers</span></a></span><span> </span><span class="annot"><span class="annottext">[Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)]
</span><a href="#local-6989586621681067631"><span class="hs-identifier hs-var">tops</span></a></span><span>
</span><span id="line-51"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621681067626"><span class="annot"><span class="annottext">ModuleSRTInfo
</span><a href="#local-6989586621681067626"><span class="hs-identifier hs-var">srtInfo</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681067625"><span class="annot"><span class="annottext">[CmmDeclSRTs]
</span><a href="#local-6989586621681067625"><span class="hs-identifier hs-var">cmms</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;doSRTs&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ModuleSRTInfo
-&gt; [(CAFEnv, CmmGroup)]
-&gt; [(Set CAFLabel, CmmDecl)]
-&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
</span><a href="GHC.Cmm.Info.Build.html#doSRTs"><span class="hs-identifier hs-var">doSRTs</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067633"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleSRTInfo
</span><a href="#local-6989586621681067639"><span class="hs-identifier hs-var">srtInfo</span></a></span><span> </span><span class="annot"><span class="annottext">[(CAFEnv, CmmGroup)]
</span><a href="#local-6989586621681067628"><span class="hs-identifier hs-var">procs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Set CAFLabel, CmmDecl)]
</span><a href="#local-6989586621681067627"><span class="hs-identifier hs-var">data_</span></a></span><span>
</span><span id="line-52"></span><span>     </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067633"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_cps"><span class="hs-identifier hs-var">Opt_D_dump_cmm_cps</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post CPS Cmm&quot;</span></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCMM"><span class="hs-identifier hs-var">FormatCMM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[CmmDeclSRTs] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[CmmDeclSRTs]
</span><a href="#local-6989586621681067625"><span class="hs-identifier hs-var">cmms</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span>     </span><span class="annot"><span class="annottext">(ModuleSRTInfo, [CmmDeclSRTs]) -&gt; IO (ModuleSRTInfo, [CmmDeclSRTs])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleSRTInfo
</span><a href="#local-6989586621681067626"><span class="hs-identifier hs-var">srtInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[CmmDeclSRTs]
</span><a href="#local-6989586621681067625"><span class="hs-identifier hs-var">cmms</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681067634"><span class="annot"><span class="annottext">forceRes :: (a, t a) -&gt; ()
</span><a href="#local-6989586621681067634"><span class="hs-identifier hs-var hs-var">forceRes</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681067617"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681067617"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681067616"><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621681067616"><span class="hs-identifier hs-var">group</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-57"></span><span>          </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681067617"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; () -&gt; ()) -&gt; () -&gt; t a -&gt; ()
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681067614"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681067614"><span class="hs-identifier hs-var">decl</span></a></span></span><span> </span><span id="local-6989586621681067613"><span class="annot"><span class="annottext">()
</span><a href="#local-6989586621681067613"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681067614"><span class="hs-identifier hs-var">decl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">()
</span><a href="#local-6989586621681067613"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621681067616"><span class="hs-identifier hs-var">group</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span>        </span><span id="local-6989586621681067636"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681067636"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067640"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span class="annot"><a href="GHC.Cmm.Pipeline.html#cpsTop"><span class="hs-identifier hs-type">cpsTop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmDecl"><span class="hs-identifier hs-type">CmmDecl</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Info.Build.html#CAFEnv"><span class="hs-identifier hs-type">CAFEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.html#CmmDecl"><span class="hs-identifier hs-type">CmmDecl</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Info.Build.html#CAFSet"><span class="hs-identifier hs-type">CAFSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmDecl"><span class="hs-identifier hs-type">CmmDecl</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span id="cpsTop"><span class="annot"><span class="annottext">cpsTop :: HscEnv
-&gt; CmmDecl
-&gt; IO (Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl))
</span><a href="GHC.Cmm.Pipeline.html#cpsTop"><span class="hs-identifier hs-var hs-var">cpsTop</span></a></span></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681067611"><span class="annot"><span class="annottext">p :: CmmDecl
</span><a href="#local-6989586621681067611"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#CmmData"><span class="hs-identifier hs-type">CmmData</span></a></span><span> </span><span class="annot"><span class="annottext">Section
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681067609"><span class="annot"><span class="annottext">GenCmmStatics 'False
</span><a href="#local-6989586621681067609"><span class="hs-identifier hs-var">statics</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)
-&gt; IO (Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Set CAFLabel, CmmDecl)
-&gt; Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenCmmStatics 'False -&gt; Set CAFLabel
</span><a href="GHC.Cmm.Info.Build.html#cafAnalData"><span class="hs-identifier hs-var">cafAnalData</span></a></span><span> </span><span class="annot"><span class="annottext">GenCmmStatics 'False
</span><a href="#local-6989586621681067609"><span class="hs-identifier hs-var">statics</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmDecl
</span><a href="#local-6989586621681067611"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span class="annot"><a href="GHC.Cmm.Pipeline.html#cpsTop"><span class="hs-identifier hs-var">cpsTop</span></a></span><span> </span><span id="local-6989586621681067607"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067607"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681067606"><span class="annot"><span class="annottext">CmmDecl
</span><a href="#local-6989586621681067606"><span class="hs-identifier hs-var">proc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-keyword">do</span><span>
</span><span id="line-65"></span><span>       </span><span class="hs-comment">----------- Control-flow optimisations ----------------------------------</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span>       </span><span class="hs-comment">-- The first round of control-flow optimisation speeds up the</span><span>
</span><span id="line-68"></span><span>       </span><span class="hs-comment">-- later passes by removing lots of empty blocks, so we do it</span><span>
</span><span id="line-69"></span><span>       </span><span class="hs-comment">-- even when optimisation isn't turned on.</span><span>
</span><span id="line-70"></span><span>       </span><span class="hs-comment">--</span><span>
</span><span id="line-71"></span><span>       </span><span class="annot"><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-type">CmmProc</span></a></span><span> </span><span id="local-6989586621681067604"><span class="annot"><span class="annottext">CmmTopInfo
</span><a href="#local-6989586621681067604"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621681067603"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681067602"><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681067602"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621681067601"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067601"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;cmmCfgOpts(1)&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-72"></span><span>            </span><span class="annot"><span class="annottext">CmmDecl -&gt; IO CmmDecl
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmDecl -&gt; IO CmmDecl) -&gt; CmmDecl -&gt; IO CmmDecl
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CmmDecl -&gt; CmmDecl
</span><a href="GHC.Cmm.ContFlowOpt.html#cmmCfgOptsProc"><span class="hs-identifier hs-var">cmmCfgOptsProc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067599"><span class="hs-identifier hs-var">splitting_proc_points</span></a></span><span> </span><span class="annot"><span class="annottext">CmmDecl
</span><a href="#local-6989586621681067606"><span class="hs-identifier hs-var">proc</span></a></span><span>
</span><span id="line-73"></span><span>       </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067598"><span class="hs-identifier hs-var">dump</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_cfg"><span class="hs-identifier hs-var">Opt_D_dump_cmm_cfg</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post control-flow optimisations&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067601"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Cmm.html#TopInfo"><span class="hs-identifier hs-type">TopInfo</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">stack_info :: CmmTopInfo -&gt; CmmStackInfo
</span><a href="GHC.Cmm.html#stack_info"><span class="hs-identifier hs-var">stack_info</span></a></span><span class="hs-glyph">=</span><span class="annot"><a href="GHC.Cmm.html#StackInfo"><span class="hs-identifier hs-type">StackInfo</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">arg_space :: CmmStackInfo -&gt; Int
</span><a href="GHC.Cmm.html#arg_space"><span class="hs-identifier hs-var">arg_space</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681067592"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681067592"><span class="hs-identifier hs-var">entry_off</span></a></span></span><span>
</span><span id="line-76"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">do_layout :: CmmStackInfo -&gt; Bool
</span><a href="GHC.Cmm.html#do_layout"><span class="hs-identifier hs-var">do_layout</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681067590"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067590"><span class="hs-identifier hs-var">do_layout</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CmmTopInfo
</span><a href="#local-6989586621681067604"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span>       </span><span class="hs-comment">----------- Eliminate common blocks -------------------------------------</span><span>
</span><span id="line-79"></span><span>       </span><span id="local-6989586621681067589"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067589"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;elimCommonBlocks&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-80"></span><span>            </span><span class="annot"><span class="annottext">GeneralFlag
-&gt; (CmmGraph -&gt; CmmGraph)
-&gt; CmmGraph
-&gt; DumpFlag
-&gt; String
-&gt; IO CmmGraph
</span><a href="#local-6989586621681067588"><span class="hs-identifier hs-var">condPass</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_CmmElimCommonBlocks"><span class="hs-identifier hs-var">Opt_CmmElimCommonBlocks</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; CmmGraph
</span><a href="GHC.Cmm.CommonBlockElim.html#elimCommonBlocks"><span class="hs-identifier hs-var">elimCommonBlocks</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067601"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-81"></span><span>                          </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_cbe"><span class="hs-identifier hs-var">Opt_D_dump_cmm_cbe</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post common block elimination&quot;</span></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span>       </span><span class="hs-comment">-- Any work storing block Labels must be performed _after_</span><span>
</span><span id="line-84"></span><span>       </span><span class="hs-comment">-- elimCommonBlocks</span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>       </span><span class="hs-comment">----------- Implement switches ------------------------------------------</span><span>
</span><span id="line-87"></span><span>       </span><span id="local-6989586621681067584"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;createSwitchPlans&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-88"></span><span>            </span><span class="annot"><span class="annottext">UniqSM CmmGraph -&gt; IO CmmGraph
forall a. UniqSM a -&gt; IO a
</span><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-var">runUniqSM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSM CmmGraph -&gt; IO CmmGraph) -&gt; UniqSM CmmGraph -&gt; IO CmmGraph
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; CmmGraph -&gt; UniqSM CmmGraph
</span><a href="GHC.Cmm.Switch.Implement.html#cmmImplementSwitchPlans"><span class="hs-identifier hs-var">cmmImplementSwitchPlans</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067589"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-89"></span><span>       </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067598"><span class="hs-identifier hs-var">dump</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_switch"><span class="hs-identifier hs-var">Opt_D_dump_cmm_switch</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post switch plan&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>       </span><span class="hs-comment">----------- Proc points -------------------------------------------------</span><span>
</span><span id="line-92"></span><span>       </span><span class="hs-keyword">let</span><span>
</span><span id="line-93"></span><span>         </span><span class="annot"><a href="#local-6989586621681067579"><span class="hs-identifier hs-type">call_pps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.ProcPoint.html#ProcPointSet"><span class="hs-identifier hs-type">ProcPointSet</span></a></span><span> </span><span class="hs-comment">-- LabelMap</span><span>
</span><span id="line-94"></span><span>         </span><span id="local-6989586621681067579"><span class="annot"><span class="annottext">call_pps :: ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var hs-var">call_pps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;callProcPoints&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; ProcPointSet
</span><a href="GHC.Cmm.ProcPoint.html#callProcPoints"><span class="hs-identifier hs-var">callProcPoints</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-95"></span><span>       </span><span id="local-6989586621681067577"><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067577"><span class="hs-identifier hs-var">proc_points</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-96"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067599"><span class="hs-identifier hs-var">splitting_proc_points</span></a></span><span>
</span><span id="line-97"></span><span>             </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-98"></span><span>               </span><span id="local-6989586621681067576"><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067576"><span class="hs-identifier hs-var">pp</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;minimalProcPointSet&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">UniqSM ProcPointSet -&gt; IO ProcPointSet
forall a. UniqSM a -&gt; IO a
</span><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-var">runUniqSM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSM ProcPointSet -&gt; IO ProcPointSet)
-&gt; UniqSM ProcPointSet -&gt; IO ProcPointSet
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-99"></span><span>                  </span><span class="annot"><span class="annottext">Platform -&gt; ProcPointSet -&gt; CmmGraph -&gt; UniqSM ProcPointSet
</span><a href="GHC.Cmm.ProcPoint.html#minimalProcPointSet"><span class="hs-identifier hs-var">minimalProcPointSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var">call_pps</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-100"></span><span>               </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_proc"><span class="hs-identifier hs-var">Opt_D_dump_cmm_proc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Proc points&quot;</span></span><span>
</span><span id="line-101"></span><span>                     </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCMM"><span class="hs-identifier hs-var">FormatCMM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CLabel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067576"><span class="hs-identifier hs-var">pp</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span>               </span><span class="annot"><span class="annottext">ProcPointSet -&gt; IO ProcPointSet
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067576"><span class="hs-identifier hs-var">pp</span></a></span><span>
</span><span id="line-103"></span><span>             </span><span class="hs-keyword">else</span><span>
</span><span id="line-104"></span><span>               </span><span class="annot"><span class="annottext">ProcPointSet -&gt; IO ProcPointSet
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var">call_pps</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>       </span><span class="hs-comment">----------- Layout the stack and manifest Sp ----------------------------</span><span>
</span><span id="line-107"></span><span>       </span><span class="hs-special">(</span><span id="local-6989586621681067571"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067571"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681067570"><span class="annot"><span class="annottext">LabelMap StackMap
</span><a href="#local-6989586621681067570"><span class="hs-identifier hs-var">stackmaps</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-108"></span><span>            </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;layoutStack&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-109"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067590"><span class="hs-identifier hs-var">do_layout</span></a></span><span>
</span><span id="line-110"></span><span>               </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">UniqSM (CmmGraph, LabelMap StackMap)
-&gt; IO (CmmGraph, LabelMap StackMap)
forall a. UniqSM a -&gt; IO a
</span><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-var">runUniqSM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSM (CmmGraph, LabelMap StackMap)
 -&gt; IO (CmmGraph, LabelMap StackMap))
-&gt; UniqSM (CmmGraph, LabelMap StackMap)
-&gt; IO (CmmGraph, LabelMap StackMap)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; ProcPointSet
-&gt; Int
-&gt; CmmGraph
-&gt; UniqSM (CmmGraph, LabelMap StackMap)
</span><a href="GHC.Cmm.LayoutStack.html#cmmLayoutStack"><span class="hs-identifier hs-var">cmmLayoutStack</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067577"><span class="hs-identifier hs-var">proc_points</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681067592"><span class="hs-identifier hs-var">entry_off</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-111"></span><span>               </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(CmmGraph, LabelMap StackMap) -&gt; IO (CmmGraph, LabelMap StackMap)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067584"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LabelMap StackMap
forall (map :: * -&gt; *) a. IsMap map =&gt; map a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapEmpty"><span class="hs-identifier hs-var">mapEmpty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>       </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067598"><span class="hs-identifier hs-var">dump</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_sp"><span class="hs-identifier hs-var">Opt_D_dump_cmm_sp</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Layout Stack&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067571"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>       </span><span class="hs-comment">----------- Sink and inline assignments  --------------------------------</span><span>
</span><span id="line-115"></span><span>       </span><span id="local-6989586621681067566"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067566"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;sink&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Sinking after stack layout]</span><span>
</span><span id="line-116"></span><span>            </span><span class="annot"><span class="annottext">GeneralFlag
-&gt; (CmmGraph -&gt; CmmGraph)
-&gt; CmmGraph
-&gt; DumpFlag
-&gt; String
-&gt; IO CmmGraph
</span><a href="#local-6989586621681067588"><span class="hs-identifier hs-var">condPass</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_CmmSink"><span class="hs-identifier hs-var">Opt_CmmSink</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; CmmGraph -&gt; CmmGraph
</span><a href="GHC.Cmm.Sink.html#cmmSink"><span class="hs-identifier hs-var">cmmSink</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067571"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-117"></span><span>                     </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_sink"><span class="hs-identifier hs-var">Opt_D_dump_cmm_sink</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Sink assignments&quot;</span></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span>       </span><span class="hs-comment">------------- CAF analysis ----------------------------------------------</span><span>
</span><span id="line-120"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681067562"><span class="annot"><span class="annottext">cafEnv :: CAFEnv
</span><a href="#local-6989586621681067562"><span class="hs-identifier hs-var hs-var">cafEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;cafAnal&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">ProcPointSet -&gt; CLabel -&gt; CmmGraph -&gt; CAFEnv
</span><a href="GHC.Cmm.Info.Build.html#cafAnal"><span class="hs-identifier hs-var">cafAnal</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var">call_pps</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067566"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-121"></span><span>       </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_caf"><span class="hs-identifier hs-var">Opt_D_dump_cmm_caf</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CAFEnv&quot;</span></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatText"><span class="hs-identifier hs-var">FormatText</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CAFEnv -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CAFEnv
</span><a href="#local-6989586621681067562"><span class="hs-identifier hs-var">cafEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>       </span><span id="local-6989586621681067558"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067558"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067599"><span class="hs-identifier hs-var">splitting_proc_points</span></a></span><span>
</span><span id="line-124"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-125"></span><span>               </span><span class="hs-comment">------------- Split into separate procedures -----------------------</span><span>
</span><span id="line-126"></span><span>               </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681067557"><span class="annot"><span class="annottext">pp_map :: LabelMap Status
</span><a href="#local-6989586621681067557"><span class="hs-identifier hs-var hs-var">pp_map</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;procPointAnalysis&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-127"></span><span>                            </span><span class="annot"><span class="annottext">ProcPointSet -&gt; CmmGraph -&gt; LabelMap Status
</span><a href="GHC.Cmm.ProcPoint.html#procPointAnalysis"><span class="hs-identifier hs-var">procPointAnalysis</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067577"><span class="hs-identifier hs-var">proc_points</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067566"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-128"></span><span>               </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_procmap"><span class="hs-identifier hs-var">Opt_D_dump_cmm_procmap</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;procpoint map&quot;</span></span><span>
</span><span id="line-129"></span><span>                  </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCMM"><span class="hs-identifier hs-var">FormatCMM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LabelMap Status -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LabelMap Status
</span><a href="#local-6989586621681067557"><span class="hs-identifier hs-var">pp_map</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>               </span><span id="local-6989586621681067554"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067554"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;splitAtProcPoints&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">UniqSM CmmGroup -&gt; IO CmmGroup
forall a. UniqSM a -&gt; IO a
</span><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-var">runUniqSM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSM CmmGroup -&gt; IO CmmGroup) -&gt; UniqSM CmmGroup -&gt; IO CmmGroup
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-131"></span><span>                    </span><span class="annot"><span class="annottext">DynFlags
-&gt; CLabel
-&gt; ProcPointSet
-&gt; ProcPointSet
-&gt; LabelMap Status
-&gt; CmmDecl
-&gt; UniqSM CmmGroup
</span><a href="GHC.Cmm.ProcPoint.html#splitAtProcPoints"><span class="hs-identifier hs-var">splitAtProcPoints</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var">call_pps</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067577"><span class="hs-identifier hs-var">proc_points</span></a></span><span> </span><span class="annot"><span class="annottext">LabelMap Status
</span><a href="#local-6989586621681067557"><span class="hs-identifier hs-var">pp_map</span></a></span><span>
</span><span id="line-132"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmTopInfo -&gt; CLabel -&gt; [GlobalReg] -&gt; CmmGraph -&gt; CmmDecl
forall d h g. h -&gt; CLabel -&gt; [GlobalReg] -&gt; g -&gt; GenCmmDecl d h g
</span><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-var">CmmProc</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTopInfo
</span><a href="#local-6989586621681067604"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681067602"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067566"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>               </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGroup -&gt; IO ()
forall {t :: * -&gt; *} {a}.
(Foldable t, Outputable a) =&gt;
DumpFlag -&gt; String -&gt; t a -&gt; IO ()
</span><a href="#local-6989586621681067552"><span class="hs-identifier hs-var">dumps</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_split"><span class="hs-identifier hs-var">Opt_D_dump_cmm_split</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post splitting&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067554"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-134"></span><span>               </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067554"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-135"></span><span>             </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-136"></span><span>               </span><span class="hs-comment">-- attach info tables to return points</span><span>
</span><span id="line-137"></span><span>               </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmGroup -&gt; IO CmmGroup) -&gt; CmmGroup -&gt; IO CmmGroup
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ProcPointSet -&gt; CmmDecl -&gt; CmmDecl
</span><a href="GHC.Cmm.ProcPoint.html#attachContInfoTables"><span class="hs-identifier hs-var">attachContInfoTables</span></a></span><span> </span><span class="annot"><span class="annottext">ProcPointSet
</span><a href="#local-6989586621681067579"><span class="hs-identifier hs-var">call_pps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmTopInfo -&gt; CLabel -&gt; [GlobalReg] -&gt; CmmGraph -&gt; CmmDecl
forall d h g. h -&gt; CLabel -&gt; [GlobalReg] -&gt; g -&gt; GenCmmDecl d h g
</span><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-var">CmmProc</span></a></span><span> </span><span class="annot"><span class="annottext">CmmTopInfo
</span><a href="#local-6989586621681067604"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681067603"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681067602"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067566"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span>       </span><span class="hs-comment">------------- Populate info tables with stack info -----------------</span><span>
</span><span id="line-140"></span><span>       </span><span id="local-6989586621681067549"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067549"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;setInfoTableStackMap&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-141"></span><span>            </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmGroup -&gt; IO CmmGroup) -&gt; CmmGroup -&gt; IO CmmGroup
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmDecl -&gt; CmmDecl) -&gt; CmmGroup -&gt; CmmGroup
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; LabelMap StackMap -&gt; CmmDecl -&gt; CmmDecl
</span><a href="GHC.Cmm.LayoutStack.html#setInfoTableStackMap"><span class="hs-identifier hs-var">setInfoTableStackMap</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681067547"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">LabelMap StackMap
</span><a href="#local-6989586621681067570"><span class="hs-identifier hs-var">stackmaps</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067558"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-142"></span><span>       </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGroup -&gt; IO ()
forall {t :: * -&gt; *} {a}.
(Foldable t, Outputable a) =&gt;
DumpFlag -&gt; String -&gt; t a -&gt; IO ()
</span><a href="#local-6989586621681067552"><span class="hs-identifier hs-var">dumps</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_info"><span class="hs-identifier hs-var">Opt_D_dump_cmm_info</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;after setInfoTableStackMap&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067549"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>       </span><span class="hs-comment">----------- Control-flow optimisations -----------------------------</span><span>
</span><span id="line-145"></span><span>       </span><span id="local-6989586621681067545"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067545"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;cmmCfgOpts(2)&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-146"></span><span>            </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmGroup -&gt; IO CmmGroup) -&gt; CmmGroup -&gt; IO CmmGroup
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#optLevel"><span class="hs-identifier hs-var hs-var">optLevel</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-147"></span><span>                     </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(CmmDecl -&gt; CmmDecl) -&gt; CmmGroup -&gt; CmmGroup
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; CmmDecl -&gt; CmmDecl
</span><a href="GHC.Cmm.ContFlowOpt.html#cmmCfgOptsProc"><span class="hs-identifier hs-var">cmmCfgOptsProc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067599"><span class="hs-identifier hs-var">splitting_proc_points</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067549"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-148"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067549"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-149"></span><span>       </span><span id="local-6989586621681067543"><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067543"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CmmGroup -&gt; IO CmmGroup
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CmmDecl -&gt; CmmDecl) -&gt; CmmGroup -&gt; CmmGroup
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">CmmDecl -&gt; CmmDecl
</span><a href="GHC.Cmm.ContFlowOpt.html#removeUnreachableBlocksProc"><span class="hs-identifier hs-var">removeUnreachableBlocksProc</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067545"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span>            </span><span class="hs-comment">-- See Note [unreachable blocks]</span><span>
</span><span id="line-151"></span><span>       </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGroup -&gt; IO ()
forall {t :: * -&gt; *} {a}.
(Foldable t, Outputable a) =&gt;
DumpFlag -&gt; String -&gt; t a -&gt; IO ()
</span><a href="#local-6989586621681067552"><span class="hs-identifier hs-var">dumps</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_cfg"><span class="hs-identifier hs-var">Opt_D_dump_cmm_cfg</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Post control-flow optimisations&quot;</span></span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067543"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span>       </span><span class="annot"><span class="annottext">Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)
-&gt; IO (Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(CAFEnv, CmmGroup)
-&gt; Either (CAFEnv, CmmGroup) (Set CAFLabel, CmmDecl)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CAFEnv
</span><a href="#local-6989586621681067562"><span class="hs-identifier hs-var">cafEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CmmGroup
</span><a href="#local-6989586621681067543"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681067581"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681067607"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-156"></span><span>        </span><span id="local-6989586621681067547"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681067547"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-157"></span><span>        </span><span id="local-6989586621681067598"><span class="annot"><span class="annottext">dump :: DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067598"><span class="hs-identifier hs-var hs-var">dump</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpGraph"><span class="hs-identifier hs-var">dumpGraph</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span>        </span><span id="local-6989586621681067552"><span class="annot"><span class="annottext">dumps :: DumpFlag -&gt; String -&gt; t a -&gt; IO ()
</span><a href="#local-6989586621681067552"><span class="hs-identifier hs-var hs-var">dumps</span></a></span></span><span> </span><span id="local-6989586621681067535"><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067535"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681067534"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067534"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-160"></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; IO ()) -&gt; t a -&gt; IO ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067535"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067534"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCMM"><span class="hs-identifier hs-var">FormatCMM</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; (a -&gt; SDoc) -&gt; a -&gt; IO ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>        </span><span id="local-6989586621681067588"><span class="annot"><span class="annottext">condPass :: GeneralFlag
-&gt; (CmmGraph -&gt; CmmGraph)
-&gt; CmmGraph
-&gt; DumpFlag
-&gt; String
-&gt; IO CmmGraph
</span><a href="#local-6989586621681067588"><span class="hs-identifier hs-var hs-var">condPass</span></a></span></span><span> </span><span id="local-6989586621681067526"><span class="annot"><span class="annottext">GeneralFlag
</span><a href="#local-6989586621681067526"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681067525"><span class="annot"><span class="annottext">CmmGraph -&gt; CmmGraph
</span><a href="#local-6989586621681067525"><span class="hs-identifier hs-var">pass</span></a></span></span><span> </span><span id="local-6989586621681067524"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067524"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621681067523"><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067523"><span class="hs-identifier hs-var">dumpflag</span></a></span></span><span> </span><span id="local-6989586621681067522"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067522"><span class="hs-identifier hs-var">dumpname</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-163"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="#local-6989586621681067526"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-164"></span><span>               </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-165"></span><span>                    </span><span id="local-6989586621681067520"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067520"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; IO CmmGraph
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CmmGraph -&gt; IO CmmGraph) -&gt; CmmGraph -&gt; IO CmmGraph
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; CmmGraph
</span><a href="#local-6989586621681067525"><span class="hs-identifier hs-var">pass</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067524"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-166"></span><span>                    </span><span class="annot"><span class="annottext">DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067598"><span class="hs-identifier hs-var">dump</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067523"><span class="hs-identifier hs-var">dumpflag</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067522"><span class="hs-identifier hs-var">dumpname</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067520"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-167"></span><span>                    </span><span class="annot"><span class="annottext">CmmGraph -&gt; IO CmmGraph
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067520"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-168"></span><span>               </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; IO CmmGraph
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067524"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span>        </span><span class="hs-comment">-- we don't need to split proc points for the NCG, unless</span><span>
</span><span id="line-171"></span><span>        </span><span class="hs-comment">-- tablesNextToCode is off.  The latter is because we have no</span><span>
</span><span id="line-172"></span><span>        </span><span class="hs-comment">-- label to put on info tables for basic blocks that are not</span><span>
</span><span id="line-173"></span><span>        </span><span class="hs-comment">-- the entry point.</span><span>
</span><span id="line-174"></span><span>        </span><span id="local-6989586621681067599"><span class="annot"><span class="annottext">splitting_proc_points :: Bool
</span><a href="#local-6989586621681067599"><span class="hs-identifier hs-var hs-var">splitting_proc_points</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; HscTarget
</span><a href="GHC.Driver.Session.html#hscTarget"><span class="hs-identifier hs-var hs-var">hscTarget</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscTarget -&gt; HscTarget -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">HscTarget
</span><a href="GHC.Driver.Session.html#HscAsm"><span class="hs-identifier hs-var">HscAsm</span></a></span><span>
</span><span id="line-175"></span><span>                             </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Bool
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformTablesNextToCode"><span class="hs-identifier hs-var hs-var">platformTablesNextToCode</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681067547"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-176"></span><span>                             </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="hs-comment">-- Note [inconsistent-pic-reg]</span><span>
</span><span id="line-177"></span><span>                                </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067511"><span class="hs-identifier hs-var">usingInconsistentPicReg</span></a></span><span>
</span><span id="line-178"></span><span>        </span><span id="local-6989586621681067511"><span class="annot"><span class="annottext">usingInconsistentPicReg :: Bool
</span><a href="#local-6989586621681067511"><span class="hs-identifier hs-var hs-var">usingInconsistentPicReg</span></a></span></span><span>
</span><span id="line-179"></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformArch"><span class="hs-identifier hs-var">platformArch</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681067547"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformOS"><span class="hs-identifier hs-var">platformOS</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681067547"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#positionIndependent"><span class="hs-identifier hs-var">positionIndependent</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067581"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span>             </span><span class="hs-keyword">of</span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchX86"><span class="hs-identifier hs-var">ArchX86</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OS
</span><a href="../../ghc-boot/src/GHC.Platform.html#OSDarwin"><span class="hs-identifier hs-var">OSDarwin</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681067505"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067505"><span class="hs-identifier hs-var">pic</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681067505"><span class="hs-identifier hs-var">pic</span></a></span><span>
</span><span id="line-181"></span><span>                  </span><span class="annot"><span class="annottext">(Arch, OS, Bool)
</span><span class="hs-identifier">_</span></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span class="hs-comment">-- Note [Sinking after stack layout]</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-185"></span><span class="hs-comment">--</span><span>
</span><span id="line-186"></span><span class="hs-comment">-- In the past we considered running sinking pass also before stack</span><span>
</span><span id="line-187"></span><span class="hs-comment">-- layout, but after making some measurements we realized that:</span><span>
</span><span id="line-188"></span><span class="hs-comment">--</span><span>
</span><span id="line-189"></span><span class="hs-comment">--   a) running sinking only before stack layout produces slower</span><span>
</span><span id="line-190"></span><span class="hs-comment">--      code than running sinking only before stack layout</span><span>
</span><span id="line-191"></span><span class="hs-comment">--</span><span>
</span><span id="line-192"></span><span class="hs-comment">--   b) running sinking both before and after stack layout produces</span><span>
</span><span id="line-193"></span><span class="hs-comment">--      code that has the same performance as when running sinking</span><span>
</span><span id="line-194"></span><span class="hs-comment">--      only after stack layout.</span><span>
</span><span id="line-195"></span><span class="hs-comment">--</span><span>
</span><span id="line-196"></span><span class="hs-comment">-- In other words sinking before stack layout doesn't buy as anything.</span><span>
</span><span id="line-197"></span><span class="hs-comment">--</span><span>
</span><span id="line-198"></span><span class="hs-comment">-- An interesting question is &quot;why is it better to run sinking after</span><span>
</span><span id="line-199"></span><span class="hs-comment">-- stack layout&quot;? It seems that the major reason are stores and loads</span><span>
</span><span id="line-200"></span><span class="hs-comment">-- generated by stack layout. Consider this code before stack layout:</span><span>
</span><span id="line-201"></span><span class="hs-comment">--</span><span>
</span><span id="line-202"></span><span class="hs-comment">--  c1E:</span><span>
</span><span id="line-203"></span><span class="hs-comment">--      _c1C::P64 = R3;</span><span>
</span><span id="line-204"></span><span class="hs-comment">--      _c1B::P64 = R2;</span><span>
</span><span id="line-205"></span><span class="hs-comment">--      _c1A::P64 = R1;</span><span>
</span><span id="line-206"></span><span class="hs-comment">--      I64[(young&lt;c1D&gt; + 8)] = c1D;</span><span>
</span><span id="line-207"></span><span class="hs-comment">--      call stg_gc_noregs() returns to c1D, args: 8, res: 8, upd: 8;</span><span>
</span><span id="line-208"></span><span class="hs-comment">--  c1D:</span><span>
</span><span id="line-209"></span><span class="hs-comment">--      R3 = _c1C::P64;</span><span>
</span><span id="line-210"></span><span class="hs-comment">--      R2 = _c1B::P64;</span><span>
</span><span id="line-211"></span><span class="hs-comment">--      R1 = _c1A::P64;</span><span>
</span><span id="line-212"></span><span class="hs-comment">--      call (P64[(old + 8)])(R3, R2, R1) args: 8, res: 0, upd: 8;</span><span>
</span><span id="line-213"></span><span class="hs-comment">--</span><span>
</span><span id="line-214"></span><span class="hs-comment">-- Stack layout pass will save all local variables live across a call</span><span>
</span><span id="line-215"></span><span class="hs-comment">-- (_c1C, _c1B and _c1A in this example) on the stack just before</span><span>
</span><span id="line-216"></span><span class="hs-comment">-- making a call and reload them from the stack after returning from a</span><span>
</span><span id="line-217"></span><span class="hs-comment">-- call:</span><span>
</span><span id="line-218"></span><span class="hs-comment">--</span><span>
</span><span id="line-219"></span><span class="hs-comment">--  c1E:</span><span>
</span><span id="line-220"></span><span class="hs-comment">--      _c1C::P64 = R3;</span><span>
</span><span id="line-221"></span><span class="hs-comment">--      _c1B::P64 = R2;</span><span>
</span><span id="line-222"></span><span class="hs-comment">--      _c1A::P64 = R1;</span><span>
</span><span id="line-223"></span><span class="hs-comment">--      I64[Sp - 32] = c1D;</span><span>
</span><span id="line-224"></span><span class="hs-comment">--      P64[Sp - 24] = _c1A::P64;</span><span>
</span><span id="line-225"></span><span class="hs-comment">--      P64[Sp - 16] = _c1B::P64;</span><span>
</span><span id="line-226"></span><span class="hs-comment">--      P64[Sp - 8] = _c1C::P64;</span><span>
</span><span id="line-227"></span><span class="hs-comment">--      Sp = Sp - 32;</span><span>
</span><span id="line-228"></span><span class="hs-comment">--      call stg_gc_noregs() returns to c1D, args: 8, res: 8, upd: 8;</span><span>
</span><span id="line-229"></span><span class="hs-comment">--  c1D:</span><span>
</span><span id="line-230"></span><span class="hs-comment">--      _c1A::P64 = P64[Sp + 8];</span><span>
</span><span id="line-231"></span><span class="hs-comment">--      _c1B::P64 = P64[Sp + 16];</span><span>
</span><span id="line-232"></span><span class="hs-comment">--      _c1C::P64 = P64[Sp + 24];</span><span>
</span><span id="line-233"></span><span class="hs-comment">--      R3 = _c1C::P64;</span><span>
</span><span id="line-234"></span><span class="hs-comment">--      R2 = _c1B::P64;</span><span>
</span><span id="line-235"></span><span class="hs-comment">--      R1 = _c1A::P64;</span><span>
</span><span id="line-236"></span><span class="hs-comment">--      Sp = Sp + 32;</span><span>
</span><span id="line-237"></span><span class="hs-comment">--      call (P64[Sp])(R3, R2, R1) args: 8, res: 0, upd: 8;</span><span>
</span><span id="line-238"></span><span class="hs-comment">--</span><span>
</span><span id="line-239"></span><span class="hs-comment">-- If we don't run sinking pass after stack layout we are basically</span><span>
</span><span id="line-240"></span><span class="hs-comment">-- left with such code. However, running sinking on this code can lead</span><span>
</span><span id="line-241"></span><span class="hs-comment">-- to significant improvements:</span><span>
</span><span id="line-242"></span><span class="hs-comment">--</span><span>
</span><span id="line-243"></span><span class="hs-comment">--  c1E:</span><span>
</span><span id="line-244"></span><span class="hs-comment">--      I64[Sp - 32] = c1D;</span><span>
</span><span id="line-245"></span><span class="hs-comment">--      P64[Sp - 24] = R1;</span><span>
</span><span id="line-246"></span><span class="hs-comment">--      P64[Sp - 16] = R2;</span><span>
</span><span id="line-247"></span><span class="hs-comment">--      P64[Sp - 8] = R3;</span><span>
</span><span id="line-248"></span><span class="hs-comment">--      Sp = Sp - 32;</span><span>
</span><span id="line-249"></span><span class="hs-comment">--      call stg_gc_noregs() returns to c1D, args: 8, res: 8, upd: 8;</span><span>
</span><span id="line-250"></span><span class="hs-comment">--  c1D:</span><span>
</span><span id="line-251"></span><span class="hs-comment">--      R3 = P64[Sp + 24];</span><span>
</span><span id="line-252"></span><span class="hs-comment">--      R2 = P64[Sp + 16];</span><span>
</span><span id="line-253"></span><span class="hs-comment">--      R1 = P64[Sp + 8];</span><span>
</span><span id="line-254"></span><span class="hs-comment">--      Sp = Sp + 32;</span><span>
</span><span id="line-255"></span><span class="hs-comment">--      call (P64[Sp])(R3, R2, R1) args: 8, res: 0, upd: 8;</span><span>
</span><span id="line-256"></span><span class="hs-comment">--</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- Now we only have 9 assignments instead of 15.</span><span>
</span><span id="line-258"></span><span class="hs-comment">--</span><span>
</span><span id="line-259"></span><span class="hs-comment">-- There is one case when running sinking before stack layout could</span><span>
</span><span id="line-260"></span><span class="hs-comment">-- be beneficial. Consider this:</span><span>
</span><span id="line-261"></span><span class="hs-comment">--</span><span>
</span><span id="line-262"></span><span class="hs-comment">--   L1:</span><span>
</span><span id="line-263"></span><span class="hs-comment">--      x = y</span><span>
</span><span id="line-264"></span><span class="hs-comment">--      call f() returns L2</span><span>
</span><span id="line-265"></span><span class="hs-comment">--   L2: ...x...y...</span><span>
</span><span id="line-266"></span><span class="hs-comment">--</span><span>
</span><span id="line-267"></span><span class="hs-comment">-- Since both x and y are live across a call to f, they will be stored</span><span>
</span><span id="line-268"></span><span class="hs-comment">-- on the stack during stack layout and restored after the call:</span><span>
</span><span id="line-269"></span><span class="hs-comment">--</span><span>
</span><span id="line-270"></span><span class="hs-comment">--   L1:</span><span>
</span><span id="line-271"></span><span class="hs-comment">--      x = y</span><span>
</span><span id="line-272"></span><span class="hs-comment">--      P64[Sp - 24] = L2</span><span>
</span><span id="line-273"></span><span class="hs-comment">--      P64[Sp - 16] = x</span><span>
</span><span id="line-274"></span><span class="hs-comment">--      P64[Sp - 8]  = y</span><span>
</span><span id="line-275"></span><span class="hs-comment">--      Sp = Sp - 24</span><span>
</span><span id="line-276"></span><span class="hs-comment">--      call f() returns L2</span><span>
</span><span id="line-277"></span><span class="hs-comment">--   L2:</span><span>
</span><span id="line-278"></span><span class="hs-comment">--      y = P64[Sp + 16]</span><span>
</span><span id="line-279"></span><span class="hs-comment">--      x = P64[Sp + 8]</span><span>
</span><span id="line-280"></span><span class="hs-comment">--      Sp = Sp + 24</span><span>
</span><span id="line-281"></span><span class="hs-comment">--      ...x...y...</span><span>
</span><span id="line-282"></span><span class="hs-comment">--</span><span>
</span><span id="line-283"></span><span class="hs-comment">-- However, if we run sinking before stack layout we would propagate x</span><span>
</span><span id="line-284"></span><span class="hs-comment">-- to its usage place (both x and y must be local register for this to</span><span>
</span><span id="line-285"></span><span class="hs-comment">-- be possible - global registers cannot be floated past a call):</span><span>
</span><span id="line-286"></span><span class="hs-comment">--</span><span>
</span><span id="line-287"></span><span class="hs-comment">--   L1:</span><span>
</span><span id="line-288"></span><span class="hs-comment">--      x = y</span><span>
</span><span id="line-289"></span><span class="hs-comment">--      call f() returns L2</span><span>
</span><span id="line-290"></span><span class="hs-comment">--   L2: ...y...y...</span><span>
</span><span id="line-291"></span><span class="hs-comment">--</span><span>
</span><span id="line-292"></span><span class="hs-comment">-- Thus making x dead at the call to f(). If we ran stack layout now</span><span>
</span><span id="line-293"></span><span class="hs-comment">-- we would generate less stores and loads:</span><span>
</span><span id="line-294"></span><span class="hs-comment">--</span><span>
</span><span id="line-295"></span><span class="hs-comment">--   L1:</span><span>
</span><span id="line-296"></span><span class="hs-comment">--      x = y</span><span>
</span><span id="line-297"></span><span class="hs-comment">--      P64[Sp - 16] = L2</span><span>
</span><span id="line-298"></span><span class="hs-comment">--      P64[Sp - 8]  = y</span><span>
</span><span id="line-299"></span><span class="hs-comment">--      Sp = Sp - 16</span><span>
</span><span id="line-300"></span><span class="hs-comment">--      call f() returns L2</span><span>
</span><span id="line-301"></span><span class="hs-comment">--   L2:</span><span>
</span><span id="line-302"></span><span class="hs-comment">--      y = P64[Sp + 8]</span><span>
</span><span id="line-303"></span><span class="hs-comment">--      Sp = Sp + 16</span><span>
</span><span id="line-304"></span><span class="hs-comment">--      ...y...y...</span><span>
</span><span id="line-305"></span><span class="hs-comment">--</span><span>
</span><span id="line-306"></span><span class="hs-comment">-- But since we don't see any benefits from running sinking before stack</span><span>
</span><span id="line-307"></span><span class="hs-comment">-- layout, this situation probably doesn't arise too often in practice.</span><span>
</span><span id="line-308"></span><span class="hs-comment">--</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="hs-comment">{- Note [inconsistent-pic-reg]

On x86/Darwin, PIC is implemented by inserting a sequence like

    call 1f
 1: popl %reg

at the proc entry point, and then referring to labels as offsets from
%reg.  If we don't split proc points, then we could have many entry
points in a proc that would need this sequence, and each entry point
would then get a different value for %reg.  If there are any join
points, then at the join point we don't have a consistent value for
%reg, so we don't know how to refer to labels.

Hence, on x86/Darwin, we have to split proc points, and then each proc
point will get its own PIC initialisation sequence.

This isn't an issue on x86/ELF, where the sequence is

    call 1f
 1: popl %reg
    addl $_GLOBAL_OFFSET_TABLE_+(.-1b), %reg

so %reg always has a consistent value: the address of
_GLOBAL_OFFSET_TABLE_, regardless of which entry point we arrived via.

-}</span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span class="hs-comment">{- Note [unreachable blocks]

The control-flow optimiser sometimes leaves unreachable blocks behind
containing junk code.  These aren't necessarily a problem, but
removing them is good because it might save time in the native code
generator later.

-}</span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span id="local-6989586621681067765"><span class="annot"><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-type">runUniqSM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681067765"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681067765"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-348"></span><span id="runUniqSM"><span class="annot"><span class="annottext">runUniqSM :: forall a. UniqSM a -&gt; IO a
</span><a href="GHC.Cmm.Pipeline.html#runUniqSM"><span class="hs-identifier hs-var hs-var">runUniqSM</span></a></span></span><span> </span><span id="local-6989586621681067502"><span class="annot"><span class="annottext">UniqSM a
</span><a href="#local-6989586621681067502"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-349"></span><span>  </span><span id="local-6989586621681067501"><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681067501"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Char -&gt; IO UniqSupply
</span><a href="GHC.Types.Unique.Supply.html#mkSplitUniqSupply"><span class="hs-identifier hs-var">mkSplitUniqSupply</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'u'</span></span><span>
</span><span id="line-350"></span><span>  </span><span class="annot"><span class="annottext">a -&gt; IO a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSupply -&gt; UniqSM a -&gt; a
forall a. UniqSupply -&gt; UniqSM a -&gt; a
</span><a href="GHC.Types.Unique.Supply.html#initUs_"><span class="hs-identifier hs-var">initUs_</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681067501"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSM a
</span><a href="#local-6989586621681067502"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>
</span><span id="line-353"></span><span class="annot"><a href="GHC.Cmm.Pipeline.html#dumpGraph"><span class="hs-identifier hs-type">dumpGraph</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#DumpFlag"><span class="hs-identifier hs-type">DumpFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.html#CmmGraph"><span class="hs-identifier hs-type">CmmGraph</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-354"></span><span id="dumpGraph"><span class="annot"><span class="annottext">dumpGraph :: DynFlags -&gt; DumpFlag -&gt; String -&gt; CmmGraph -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpGraph"><span class="hs-identifier hs-var hs-var">dumpGraph</span></a></span></span><span> </span><span id="local-6989586621681067498"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681067497"><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067497"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681067496"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067496"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681067495"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067495"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-355"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_DoCmmLinting"><span class="hs-identifier hs-var">Opt_DoCmmLinting</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067492"><span class="hs-identifier hs-var">do_lint</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067495"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-356"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var">dumpWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067497"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067496"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCMM"><span class="hs-identifier hs-var">FormatCMM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CmmGraph -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067495"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-358"></span><span>  </span><span id="local-6989586621681067492"><span class="annot"><span class="annottext">do_lint :: CmmGraph -&gt; IO ()
</span><a href="#local-6989586621681067492"><span class="hs-identifier hs-var hs-var">do_lint</span></a></span></span><span> </span><span id="local-6989586621681067489"><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067489"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; CmmGraph -&gt; Maybe SDoc
</span><a href="GHC.Cmm.Lint.html#cmmLintGraph"><span class="hs-identifier hs-var">cmmLintGraph</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CmmGraph
</span><a href="#local-6989586621681067489"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-359"></span><span>                 </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681067487"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067487"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#fatalErrorMsg"><span class="hs-identifier hs-var">fatalErrorMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067487"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-360"></span><span>                                </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; IO ()
</span><a href="GHC.Utils.Error.html#ghcExit"><span class="hs-identifier hs-var">ghcExit</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067498"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-361"></span><span>                                </span><span class="hs-special">}</span><span>
</span><span id="line-362"></span><span>                 </span><span class="annot"><span class="annottext">Maybe SDoc
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span class="annot"><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-type">dumpWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#DumpFlag"><span class="hs-identifier hs-type">DumpFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#DumpFormat"><span class="hs-identifier hs-type">DumpFormat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span id="dumpWith"><span class="annot"><span class="annottext">dumpWith :: DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Cmm.Pipeline.html#dumpWith"><span class="hs-identifier hs-var hs-var">dumpWith</span></a></span></span><span> </span><span id="local-6989586621681067484"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681067483"><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067483"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681067482"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067482"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span id="local-6989586621681067481"><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681067481"><span class="hs-identifier hs-var">fmt</span></a></span></span><span> </span><span id="local-6989586621681067480"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067480"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-366"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#dumpIfSet_dyn"><span class="hs-identifier hs-var">dumpIfSet_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067483"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067482"><span class="hs-identifier hs-var">txt</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681067481"><span class="hs-identifier hs-var">fmt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067480"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-367"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DumpFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#dopt"><span class="hs-identifier hs-var">dopt</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067483"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-368"></span><span>    </span><span class="hs-comment">-- If `-ddump-cmm-verbose -ddump-to-file` is specified,</span><span>
</span><span id="line-369"></span><span>    </span><span class="hs-comment">-- dump each Cmm pipeline stage output to a separate file.  #16930</span><span>
</span><span id="line-370"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DumpFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#dopt"><span class="hs-identifier hs-var">dopt</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_verbose"><span class="hs-identifier hs-var">Opt_D_dump_cmm_verbose</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-371"></span><span>      </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DumpAction
</span><a href="GHC.Utils.Error.html#dumpAction"><span class="hs-identifier hs-var">dumpAction</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PrintUnqualified -&gt; PprStyle
</span><a href="GHC.Utils.Outputable.html#mkDumpStyle"><span class="hs-identifier hs-var">mkDumpStyle</span></a></span><span> </span><span class="annot"><span class="annottext">PrintUnqualified
</span><a href="GHC.Utils.Outputable.html#alwaysQualify"><span class="hs-identifier hs-var">alwaysQualify</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DumpFlag -&gt; DumpOptions
</span><a href="GHC.Utils.Error.html#dumpOptionsFromFlag"><span class="hs-identifier hs-var">dumpOptionsFromFlag</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="#local-6989586621681067483"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067482"><span class="hs-identifier hs-var">txt</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681067481"><span class="hs-identifier hs-var">fmt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067480"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-373"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#dumpIfSet_dyn"><span class="hs-identifier hs-var">dumpIfSet_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681067484"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_cmm_verbose_by_proc"><span class="hs-identifier hs-var">Opt_D_dump_cmm_verbose_by_proc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681067482"><span class="hs-identifier hs-var">txt</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="#local-6989586621681067481"><span class="hs-identifier hs-var">fmt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681067480"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-374"></span></pre></body></html>